<template>
	<fui-data-tag :multiple="multiple" v-model="choseData" :options="options" background="#F3F3F3"
		activeBgColor="#F2F3FF" activeColor="#0052D9" color="#000000"></fui-data-tag>
</template>

<script>
	import {
		useDictStore
	} from '../../../store/modules/dic'
	import {
		useSyStemStore
	} from '../../../store/modules/system'
	import {
		mapState
	} from 'pinia'
	import _ from 'lodash'
	export default {

		props: {
			dicKey: String,
			multiple: Boolean,
			modelValue: String,
		},
		emits: ['update:modelValue'],
		data() {
			return {

			}
		},
		computed: {
			...mapState(useSyStemStore, ['dicList']),
			choseData: {
				set(data) {
					this.$emit('update:modelValue', data)
				},
				get() {
					return this.modelValue
				}
			},
			options() {
				const findData = _.find(this.dicList, {
					type: this.dicKey
				})
				if (!_.isEmpty(findData)) {

					return _.map(findData.data, item => {
						return {
							...item,
							value: item.dictValue,
							text: item.dictLabel
						}
					})
				}
				return []
			}
		},
		methods: {

		}
	}
</script>

<style>

</style>